﻿#ifndef CHATITEMWIDGET_H
#define CHATITEMWIDGET_H

#include <QLabel>
#include <QVariant>

class TextLabel : public QLabel
{
    Q_OBJECT
public:
    explicit TextLabel(const QString &text, QWidget *parent=nullptr);
    bool hasHeightForWidth() const;
    int heightForWidth(int w) const;
};

class ChatItemWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ChatItemWidget(const bool from, const QVariant &display, const QPixmap &pixmap, const QString &extraText, QWidget *parent = Q_NULLPTR);
    void setDisplay(const QVariant &display, const QVariant &edit, const QString &extraText);
protected:
    void mouseDoubleClickEvent(QMouseEvent *event);
    void paintEvent(QPaintEvent *);
private slots:
    void showOriginal();
signals:
    void contentDoubleClicked();
private:
    QLabel* content;
    QLabel* icon;
    QLabel* extra;
    QVariant original;
};

#endif // CHATITEMWIDGET_H
